import React, { useState, useEffect } from "react";
import RankLi from "../rankLi";
import { request } from "@apis/request";

const GMoneyFromAnswers = () => {
    const [list, setList] = useState([]);

    useEffect(() => {
        const getList = async (type) => {
            const res = await request("/api/answerRank", { type });
            if (res.code === "0000") {
                setList(res.data);
            } else {
                console.log("err: ", res.msg);
            }
        };
        getList(3);
    }, []);

    return (
        <>
            {list &&
                list.length > 0 &&
                list.map((item, index) => {
                    return <RankLi key={index} item={item} type={3} />;
                })}
        </>
    );
};

export default GMoneyFromAnswers;
